package com.android.wellcherish.workclock.bean.data;

import android.support.annotation.Nullable;
import com.android.wellcherish.workclock.bean.db.Record;
import com.android.wellcherish.workclock.constant.Mode;

/**
 * 带有 TAG 的记录，方便展示
 *
 * @author 张文琛
 * @date 2019/11/10 9:48
 */
public class ModeRecord {
    /**
     * 该数据的模式，可用的取值范围见{@link Mode}
     * */
    @Mode
    private int mode;
    /**
     * 打卡的文本描述
     * */
    private String content;
    /**
     * 一次打卡记录
     * */
    private Record record;

    public int getMode() {
        return mode;
    }

    public void setMode(@Mode int mode) {
        this.mode = mode;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Record getRecord() {
        return record;
    }

    public void setRecord(Record record) {
        this.record = record;
    }

    @Override public String toString() {
        return "{\"ModeRecord\":{"
            + "\"mode\":" + mode
            + ",\"content\":\"" + content + "\""
            + ",\"record\":" + record
            + "}}";
    }

    @Override public boolean equals(@Nullable Object obj) {
        if(obj == null || obj.getClass() != getClass()) {
            return false;
        }
        if(this == obj) {
            return true;
        }
        ModeRecord that = (ModeRecord) obj;

        return this.getRecord() == that.getRecord();
    }

    @Override public int hashCode() {
        int result = 17;
        result = 31 * result + Integer.hashCode(mode);
        result = 31 * result + (content == null ? 0 : content.hashCode());
        result = 31 * result + (record == null ? 0 : record.hashCode());
        return result;
    }
}
